package logic

import (
	"context"
	"fmt"
	"github.com/zeromicro/go-zero/core/logx"
	"house/houserpc/houserpc"
	"house/houserpc/internal/svc"
	"house/pkg"
)

type CacheLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCacheLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CacheLogic {
	return &CacheLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CacheLogic) Cache(in *houserpc.CacheRequest) (*houserpc.CacheResponse, error) {
	// todo: add your logic here and delete this line
	ip := pkg.GetOutboundIP()
	//cache.Rdb.Set(l.ctx,ip, time.Minute*10)
	fmt.Println(ip)
	return &houserpc.CacheResponse{}, nil
}
